//
//  TSButton.swift
//  counselor_t
//
//  Created by chenyusen on 2017/12/6.
//  Copyright © 2017年 TechSen. All rights reserved.
//

import UIKit

class TSButton: UIButton {
    var extendTouchInsets: UIEdgeInsets = UIEdgeInsets.zero
    
    override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        let newBounds = UIEdgeInsetsInsetRect(bounds, UIEdgeInsets(top: -extendTouchInsets.top,
                                                                   left: -extendTouchInsets.left,
                                                                   bottom: -extendTouchInsets.bottom,
                                                                   right: -extendTouchInsets.right))
        return super.point(inside: point, with: event) || newBounds.contains(point)
    }
}
